﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VirtualTournaments.Business.Tournaments;

namespace VirtualTournaments.Business.Bets
{
    public class TournamentSimplePositionBetTarget : BetTarget
    {
        public Tournament tournament { get; set; }

        public Team team { get; set; }

        public Position position { get; set; }

        public TournamentSimplePositionBetTarget(Tournament tournament,Team team,Position resultPrediction)
        {
            this.tournament = tournament;
            this.position = resultPrediction;
            this.team = team;
        }
        
        public override bool Occurs()
        {
            
            Team winner = (Team)this.tournament.First;
            Team secondPlace = (Team)this.tournament.Second;
            Team thirdPlace = (Team)this.tournament.Third;

            return ( (this.position == Position.First && winner == this.team)
                || (this.position == Position.Second && secondPlace == this.team)
                || (this.position == Position.Third && thirdPlace == this.team)
                );
        }
    }
}
